/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.agi.gae.test;

import org.jmock.Mockery;
import org.jmock.States;
import org.jmock.integration.junit4.JUnit4Mockery;
import org.jmock.lib.legacy.ClassImposteriser;

/**
 *
 * @author renato.grosz
 */
public class JMockSuport {
    private Mockery context;


    public JMockSuport(){
        context= new JUnit4Mockery() {
            {
                setImposteriser(ClassImposteriser.INSTANCE);
            }
        };
    }


    public Mockery getContext(){
        return(context);
    }

    
    public States novoMaquinaEstado(String nomeMaquina,String estadoInicial){
        States retorno;
        retorno=context.states(nomeMaquina).startsAs(estadoInicial);
        return(retorno);
    }


    public <T> T createMock(Class <T> type){
       T retorno;
       retorno=context.mock(type);
       return(retorno);
    }
}
